<template>
    <div id="app">
        <router-view :key="key"></router-view>
    </div>
</template>

<script>
export default {
    name: "app",
    computed: {
        common() {
            return this.$store.state.data;
        },
        // route-view 复用时组件不刷新
        key() {
            return this.$route.fullPath;
        }
    },
    watch: {
        common() {
            console.log("vuex数据更新");
            hsetStore("hvuex", JSON.stringify(this.$store.state.data));
        }
    },
    updated() {
        var arr = document.getElementsByName("himg");
        for (var i = 0; i < arr.length; i++) {
            var yyy = document.getElementsByName("himg")[i].attributes[2]
                .nodeValue;
            document.getElementsByName("himg")[i].src =
                "http://" + window.location.host + "/src/assets/" + yyy;
        }
    }
};
</script>

<style lang="scss">
body {
    font-size: rem(28);
    background-color: #fbf9fe;
}
</style>
